System and method for printing a document having merged text and graphics contained therein

ABSTRACT

A system and method of printing documents having merged text and graphics is presented which overcomes the Z-order problem of merging text and graphics on a raster printer and which enhances printing performance. The system and method analyze a location of the text and graphics elements to be printed to determine if and where any potential merging problems exist. In these regions, the system and method selectively redraws the text as part of the merged bitmap graphic. The remainder of the text on the document is printed with device resident fonts, either directly or through downloading the device font, if possible. This greatly enhances printing performance. If the text information is not supported or supportable by a device font, the text elements are drawn as bitmaps to be printed by the printer.

CROSS-REFERENCE TO RELATED PATENT APPLICATIONS

This patent application is a divisional of U.S. patent application Ser. No. 09/157,604, filed Sep. 21, 1998 now U.S. Pat. No. 6,377,354.

FIELD OF THE INVENTION

The instant invention relates to the electronic printing of documents from a computer, and more particularly to a system and method for correctly ordering and printing graphics within a merged text and graphics document for printing from a computer by a raster printer.

BACKGROUND OF THE INVENTION

Continued advances in computer technology have lead to not only increased performance, but also increased performance expectations by the users of such equipment. These increased user expectations extend not only to processing speed capability, but also to all aspects and peripheral equipment associated with a home or business computing environment. The industry has responded with increased speed for CD ROM drives, communication modems, and even faster printers having advanced document handling features. However, it is not simply enough to utilize a faster processor in conjunction with peripheral equipment having performance enhancing features without also including software drivers and an operating system which allows the full advantage of the increased hardware capabilities to be taken advantage of.

This is particularly true in the area of document printing. Initially, the vast majority of all documents sent to a computer printer were text only documents with very little, if any, formatting. The printers on which these documents were printed included daisy wheel or ball type printers which required only that the computer send down the proper character commands to allow printing of the proper text character. As the computing equipment advanced, so did the sophistication of the computer user. Strict text only unformatted documents utilizing only a single font were no longer acceptable. The computer industry responded by allowing the computer to command a printer to draw various True Type fonts which greatly enhanced the appearance of the computer printed document. However, it was a concern that the performance of the printers would be affected by having to draw all of the characters on a printed document. In response, printer manufacturers began installing device resident fonts within the memory of the printers to allow a very rapid data transfer to occur from the computer to the printer. With installed device fonts the computer is required only to send a character address code to the printer to allow the printer to select and print the correct character. This greatly reduced the amount of data transferred between computer and printer, and greatly enhanced the printing performance.

During this development of better ways to format and print text documents, the use and integration of graphics within a computer generated text document was also introduced. School and company, newsletters, technical reports, financial presentations, etc. all were utilizing text and graphics in an integrated computer printed document. Initially, the inserted graphics occupied a given space on a page, but continuing advances soon allowed the text of the document to be wrapped around the graphics, or layered over the graphics in the case of a computer generated watermark. Because the inclusion of graphics greatly enhanced the appearance of what would otherwise be considered a dull page of only text, the use of graphics greatly increased. However, it was soon realized that the use of both graphics and text in the same document presented significant problems for the computer hardware, software, and operating systems of the day.

To allow a computer generated document to be printed by a computer printer requires the use of a printer driver. Such a printer driver interfaces the output from the application program which generated the document to the physical printer device which will actually put ink on paper. The more recent printer drivers were frame buffer based with text support. As such, a page of a document to be printed was essentially split into a bitmap graphics frame 200 and a text frame 202 as illustrated in FIG. 5. The bitmap graphics frame 200 contained all of the bitmap graphical images which were to be printed on the document, while the text frame contained all of the textual information for that same document. Within this prior printer driver, both the graphics frame 200 and the text frame 202 existed at different levels within the driver as illustrated graphically in FIG. 5. Because all of the graphics in a document existed in the bitmap frame 200, the specific order and layering of these drawing objects were not always maintained when combined with the separate text frame 202 and printed at the printer device. This could result in the graphic color highlighting of the text actually covering, and therefore obscuring, the text to be highlighted. Because of the visualization of the separate frames for both text and bitmap graphics, this problem became known as the Z-order problem. This nomenclature was chosen to convey the lack of proper layering of the different frames 200, 202 as the document was printed. This Z-order problem resulted in not only a poor quality printed document which did not appear on the printed page as it did on the computer monitor.

One prior solution which overcomes the Z-ordering problem of the text and graphics draws the entire page as,a single bitmap graphic. The document to be printed is essentially transformed into a picture of the document to be printed by the computer printer. However, while this alleviates the problem of properly combining and layering the separate text and bitmap graphics frames of the prior printer driver, the resulting degradation in printer performance due to the extreme amount of data to be transferred to the printer is unacceptable. Printer speed and performance is greatly affected, and the included device fonts resident within the printer are not be utilized, therefore wasting the advanced features of modem computer printers. Such a solution, therefore, is not acceptable.

Another solution to the Z-order problem which some drivers utilize is to send objects to the printer as they are encountered from the GDI (although, this capability is not available on all printer devices). This method takes advantage of the raster operations (ROPs) which are available in the windows environment. These ROPs allow print elements to be combined in logical ways (e.g., XOR) to ensure that they are printed in the correct order. For a highlighted block of text, the GDI may send the text elements first, and then the colored box. ROP allows these elements to be combined so that the text is not printed first, and then covered (obscured) by the colored box. Unfortunately, many of the printers on the market do not support the downloading of all graphics objects or all of the ROPs available within the windows environment. As a result, a document with merged text and graphics may still not print correctly due to the lack of support for at least some of the ROP functions needed by these drivers.

There therefore exists a need in the art for a system and method which allows the correct printing of documents having merged text and graphics, i.e., incorporating a solution for the Z-order problem. However, there also exists a need for documents to be printed with enhanced performance and greater speed allowing advanced printer functions to be taken advantage of to the greatest extent possible.

BRIEF SUMMARY OF THE INVENTION

In view of the above identified and other problems existing in the art, a preferred embodiment of the instant invention provides a printer driver which overcomes the Z-order problem of correctly printing merged text and graphics documents. A preferred embodiment further enhances the printing performance by utilizing, to the maximum extent possible, the device fonts resident within the physical printer device. Preferably, an embodiment of the printer driver of the instant invention analyzes the document which it is printing to determine the overlap of any text and graphics contained therein. If an overlap of text and graphics is detected, a preferred embodiment of the printer driver of the instant invention selectively draws only the overlapping text as graphics on a frame buffer. If there is no merging or overlapping of text and graphics:on the document which is being printed, the text is simply downloaded or sent as a device font directly to the printer device. Preferably, the printer driver of the instant invention utilizes font substitution and selective drawing of text as graphics to ensure proper printing of either text only, or text and graphics merged documents without loss or degradation of printer performance.

In a preferred embodiment of the printer driver of the instant invention, the driver determines for each text object whether there is any previously drawn graphics in the bitmap where the text is to be drawn. If such a bitmap is found, the text is also drawn in the bitmap so that it can properly interact with the graphics on the printed page. If no such overlapping graphics and text is detected, the text is downloaded or sent as a device font directly to the printer to allow for better printing performance. Preferably, the printer driver of the instant invention also maintains text location information concerning the location of where text has been downloaded directly to the printer. This textual location information is utilized in the event that a graphics image is to be drawn over text which has already been downloaded to the printer. If this situation is detected, a preferred embodiment of the driver of the instant invention sends a blank bitmap image, preferably a white rectangle, directly to the printer to erase or overwrite the appropriate region in the printer to ensure correct output when the text and bitmaps are combined during the print process. Preferably, an embodiment of the printer driver of the instant invention accomplishes the above in a single pass fashion as the print commands are received from the graphics device interface (GDI). The elimination of any subsequent passes through the print command or data information, also greatly enhances the overall performance of the printing function.

These and other features of the invention will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a simplified block diagram illustrating an exemplary operating environment suitable-for application of the instant invention;

FIG. 2 is a simplified block diagram illustrating a functional flow from an operator initiated print command to document printing by a printer in accordance with an embodiment of the instant invention;

FIG. 3A and 3B illustrate a process flow diagram in accordance with the teachings of an embodiment of the instant invention;

FIG. 4 illustrates an exemplary document merging text and graphics as processed by an embodiment of the instant invention;

FIG. 5 is a graphical visualization of a prior frame buffer based driver with text support exhibiting a Z-order problem.

While the invention is susceptible of various modifications and alternative constructions, certain illustrative embodiments thereof have been shown in the drawings and will be described below in detail. It should be understood, however, that there is no intention to limit the invention to the specific forms disclosed, but on the contrary, the intention is to cover all modifications, alternative constructions and equivalents falling within the spirit and scope of the invention as defined by the appended claims.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 in the following discussion are intended to provide a brief, general description of a suitable computing environment in which the invention may be implemented. Although not required, the invention will be described in the general context of computer-executable instructions, such as program modules, being executed by a personal computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations, including hand-held devices, microprocessor systems, microprocessor-based or programmable computer electronics, network PCs, minicomputers, mainframe computers. and the like. The invention may also be practiced and distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.

With reference to FIG. 1, an exemplary system for implementing the invention includes a general purposed computing device in the form of a conventional personal computer 20, including a processing unit 21, a system memory 22, and a system bus 23 that couples various system components including the system memory to the processing unit 21. The system bus 23 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. The system memory includes read-only memory (ROM) 24 and random access memory (RAM) 25. A basic input/output system 26 (BIOS), containing the basic routines that help to transfer information, between elements within the personal computer 20, such as during startup, is stored in ROM 24. The personal computer 20 further includes a hard disk drive 27 for reading from and writing to a hard disk, not shown, a magnetic disk drive 28 for reading from or writing to a removable magnetic disk 29, and an optical disk drive 30 for reading from or writing to a removable optical disk 31 such as a CD ROM or other optical media. The hard disk drive 27, magnetic disk drive 28, and optical disk drive 30 are connected to the system bus 23 by a hard disk drive interface 32, a magnetic disk drive interface 33, and an optical drive interface 34, respectively. The drives and their associated computer-readable media provide nonvolatile storage of computer readable instructions, data structures, program modules and other date for the personal computer 20. Although the exemplary environment described herein employs a hard disk, a removable magnetic disk 29 and a removable optical disk 31, it: should be appreciated by those skilled in the art that other types of computer readable media which can store data that is accessible by the computer, such as magnetic cassettes, flash memory cards, digital video disks, Bernoulli cartridges, random access memories (RAMs), read-only memories (ROMs), and the like, may also be used in the exemplary operating environment.

A number of program modules may be stored on the hard disk, magnetic disk 29, optical disk 31, ROM 24, or RAM 25, including an operating system 35, one or more application programs 36, other program modules 37, and program data 38. A user may enter commands and information into the personal computer 20 through input devices such as a keyboard 40 and a pointing device 42. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 21 through a serial port interface 46 that is coupled to the system bus, but may be connected by other interfaces, such as a parallel port, game port, or a universal serial bus (USB). A monitor 47 or other type of display device is also connected to the system busy 23 via an interface, such as a video adapter 48. In addition to the monitor, personal computers typical include other peripheral output devices (not shown), such as speakers and printers.

The personal computer 20 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 49. The remote computer 49 may be another personal computer, a server, a router, a network PC, a peer device, or other common network node, and typically includes many or all of the elements described above relative to the personal computer 20, although only a memory storage device 50 has been illustrated in FIG. 1. The logical connections depicted in FIG. 1 include a local area network (LAN) 51 and a wide area network (WAN) 52. Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets, and the Internet.

When used in a LAN working environment, the personal computer 20 is connected to the local network 51 through a network interface or adapter 53. When used in a WAN networking environment, the personal computer 20 typically includes a modem 54 or other means for establishing communications over the y-area network 52, such as the Internet. The modem 54, which may be internal or external, is connected to the system bus 23 via the serial port interface 46. In a networked environment, program modules depicted relative to the personal computer 20, or portions thereof, may be stored in the remote memory storage device. It will be appreciated that the network connections shown are exemplary and other means of establishing the communications link between the computers may be used.

Having now described both the problem existing in the art and a suitable environment into which the solution provided by the printer driver of the instant invention is suitably applied, the focus is now turned to a description of an embodiment of the printer driver of the instant invention. As will become apparent, the method implemented in an embodiment of the instant invention overcomes the Z-order problem described above in relation to the printing of documents having merged text and graphics. Preferably, the system and method of the instant invention is implemented in a universal printer driver which may be included as part of an operating system, such as Windows NT 5.0. Such a universal printer driver is described in co-pending application Serial No. 09/157,895, filed on even date herewith, for a MODULAR AND EXTENSIBLE PRINTER DEVICE DRIVER AND TEXT BASED METHOD FOR CHARACTERIZING PRINTER DEVICES FOR USE THEREWITH, assigned to the assignee of the instant application, the disclosure and teachings of which are hereby incorporated by reference. However, as will be recognized by one skilled in the art, the system and method of the instant invention may be implemented in other architectures other than that listed above, the inclusion of which is hereby reserved.

The system and method of the instant invention will now be described in a preferred implementation with reference initially to FIG. 2. As illustrated in this figure, a document creating application program 100, upon receiving a user print command 102, transfers the document data to the graphics device interface (GDI) 104. The graphics device interface 104 serves as an interface between the application program 100 and the universal printer driver 106. This universal printer driver 106 outputs data to the printer 108 in proper form for that printer, and initiates various printer command functions in accordance with the printer characterization data supplied to it from the generic description data file (GPD). The Minidriver is optional for customization and is described in greater detail in the above referenced co-pending application which is incorporated herein by reference. The minidriver 110 is preferably supplied by the printer manufacturer to allow proper interfacing of the universal printer driver 106 with the particular control functions and supported data types implemented by this particular printer manufacturer.

As implemented in this exemplary embodiment, the system and method of the instant invention eliminates the Z-order problem existing with prior drivers when printing documents having merged text and graphics. As illustrated in FIGS. 3A and 3B, upon once called 112 the printer driver initially receives from the graphics device interface 104, among other commands, a print object 114. Upon receipt of the print object from the GDI 104, the driver then determines whether the object is a text or graphics object 116. If the print object is text, the driver compares bitmap location information stored in a memory element 118 to the location at which the text object is to be printed 120.

If this comparison reveals that there is no overlap 122 between the location at which the text object is to be printed and the location at which any bitmaps are to be printed, the driver next analyzes the text object to determine if the utilized font may be supported by a printer resident device font 124. If this text object is supported by a device resident font, the driver then sends 128 the 1, 2, or multi-byte character code to the output buffer 126 for retrieval and printing by the printer. This generation of 1, 2, or multi-byte character codes to allow the utilization of device fonts is described in detail in co-pending application Ser. No. 09/157,917, filed on even date herewith, for a PRINTER DRIVER AND METHOD FOR SUPPORTING WORLDWIDE SINGLE BINARY FONT FORMAT WITH BUILT IN SUPPORT FOR DOUBLE BYTE CHARACTERS, assigned to the assignee of the instant application , the disclosure and teachings of which are hereby incorporated by reference.

Once sent 128, the driver then stores the text object location information 130 in an memory storage element 132 (see FIG. 3B) before terminating its process 134 to wait for the receipt of another print call from the GDI 104. If, however, at decision block 124, it is determined that the text object is not supported by a printer resident or downloadable device font, the text object is drawn as a bitmap 136 on the bitmap buffer 138, as is common with the generation of True Type fonts. Once drawn 136, the text object bitmap location information is stored 140 in the memory element 118 before terminating the process 134 and waiting for a further print call from the GDI 104.

During this process, if it is determined that there is an overlap between the commanded location of the text element to be printed and an existing bitmap image as determined at block 122, the text object is drawn 142 as part of the bitmap graphic on the bitmap buffer 138. As will be described more fully hereinbelow, the region which is drawn as part of the bitmap graphic includes the union of the bounding rectangle of the bitmap graphic and that of the text element. Once this has been drawn 142 on the bitmap buffer 138, the union bitmap location information is stored 144 in memory element 118 prior to terminating the process 134 until the receipt of a further print call from the GDI 104.

If the analysis initially performed on the print object 1 16 determines that the print object is a graphical bitmap, the driver first compares 146 the location of the bitmap object to the location information of text objects sent to the output buffer 126 as stored in memory element 132. If this analysis yields that there is no overlap 148 of the location of the bitmap bounding rectangle and any printed text elements, the graphic object is drawn 150 on the bitmap buffer 138. Once drawn 150, the drawing object bitmap location information is stored 152 in memory element 118, i.e., the bitmap buffer is now “marked” since it has just been drawn into. If, however, an overlap 148 is determined to exist between the drawing object bitmap location and a text object which has been sent to the output buffer, the driver then sends a white rectangle to the output buffer to erase the text object in the printer at that location 154. (for SRCCOPY and PATCOPY Rops). The driver then draws the graphic object to the output buffer. The graphic object drawn into the buffer marks the bitmap location information and is stored 144 in the memory element 118 before terminating the process 134 and awaiting an additional print call from the GDI 104.

As will be recognized by one skilled in the art, the printing of a document requires many print calls to be processed by the printer driver, and hence the functional flow described in FIGS. 3A and 3B will be processed multiple times in the printing of a single document. As described above, in each single pass the driver determines for each object whether there is any previously drawn graphics in the bitmap where the text is to be drawn or printed. If there is, the text is drawn in the bitmap, so that it can properly interact with this graphic, thus overcoming the Z-order problem described above. If there is no overlap, the text is downloaded or sent as a device font directly to the printer (via the output buffer) for enhanced printing performance. Furthermore, a preferred embodiment of the driver of the instant invention logs the location of the text that has been downloaded directly to the printer (via the output buffer). This enables the driver to determine if any graphic bitmap is to be drawn over already downloaded text. If the driver determines from this information that a bitmap is to be drawn in the same or overlapping regions with the already downloaded text, the driver can send a white rectangle directly to the printer to erase the appropriate region in the printer to ensure correct output when the text and bitmap are redrawn as a single union bitmap graphic, and transparently combined during the print process.

To illustrate the analysis and drawing of text objects as part of the bitmap graphic, reference is now made to FIG. 4. As may be seen from this figure, both text and graphics have been merged in this document, and the text has been wrapped around the graphics. The wrapping of text around graphics has become common in many applications, such as newsletters, reports, etc. As may be seen, the words “This is a” 160, “glass to” 162, and “illustrate overlap.” 164 have no overlap with the bitmap graphic 166. However, due to the bounding rectangle 168 of the bitmap graphic 166, text elements 170 and 172 do have an overlap with the bitmap graphic 166. Specifically, the text region of the text element 170 is bounded by rectangle 174, and text element 172 is bounded by rectangle 176. As these bounding rectangles 174, 176 have an overlap with the bitmap bounding rectangle 168, the potential for merging problems (Z-order problem) described above exists. Therefore, text elements 170 and 172 are drawn as part of the bitmap graphic 166, and not printed as separate text elements. The new bitmap graphic 178 has a bounding rectangle 180 which corresponds to the union of the regions bounded by bounding rectangles 168, 174, and 176. The location of this larger bounding rectangle 180 is stored in the bitmap location memory element 1 18 illustrated in FIG. 3A. This information will be used for future comparisons with other print calls to determine if any further overlap between new text elements and this larger bitmap image 178 will exist. Any further overlaps will result in additional unions being taken (and further text elements redrawn as part of the bitmap image). In this way, the document is essentially divided into separate regions which are characterized as either text or graphics. Advantageously, this regionalizing and characterization is accomplished in a single pass per drawing call as illustrated in FIGS. 3A and 3B. Numerous modifications and alternative embodiments of the instant invention will be apparent to those skilled in the art in view of the foregoing description. Accordingly, this description is to be construed as illustrative only and is for the purpose of teaching those skilled in the art the best mode for carrying out the invention. Details of the structure and implementation of the various components described above can be varied substantially without departing from the spirit of the invention, and exclusive use of all modifications that come within the scope of the appended claims is reserved. 

What is claimed is:
 1. A method of printing a computer generated document by a raster printer, comprising the steps of: dividing at least a portion of the document into a plurality of regions; analyzing a content of the document to determine in which regions are to be printed text elements and bitmap graphics; identifying regions having both text elements and bitmap graphics to be printed therein; redrawing the text elements in regions identified as also having bitmap graphics as part of the bitmap graphic in that region; sending the text elements to an output buffer for transmission to the raster printer; and sending the bitmap graphics to a bitmap buffer for transmission to the raster printer.
 2. The method of claim 1, wherein the step of analyzing a content of the document to determine in which regions are to be printed text elements and bitmap graphics comprises the steps of: receiving a plurality of print calls from a graphics device interface, the print calls including text elements and bitmap graphics to be printed by the raster printer, the print calls further comprising location information for each text element and bitmap graphic to be printed; analyzing location information upon receipt from the graphics device interface to determine if any previously received location information from the graphics device interface for the document overlaps therewith.
 3. The method of claim 1, wherein the step of identifying regions having both text elements and bitmap graphics to be printed therein comprises the steps of: identifying a first rectangular bounding region for the text element; identifying a second rectangular bounding region for the bitmap graphics; and identifying a third rectangular bounding region comprising the union of the first and the second bounding regions.
 4. The method of claim 1, wherein the step of redrawing the text elements in regions identified as also having bitmap graphics as part of the bitmap graphic in that region comprises the step of: redrawing the bitmap graphics to include all regions within the third rectangular bounding region, the third rectangular bounding region containing only bitmap data.
 5. The method of claim 4, wherein the step of redrawing the text elements in regions identified as also having bitmap graphics as part of the bitmap graphic in that region comprises the step of causing any text elements which have previously been sent to the output buffer to be printed within the third rectangular bounding region to be eliminated from the printed document as separate text elements.
 6. The method of claim 5, wherein the step of causing any text elements which have previously been sent to the output buffer to be printed within the third rectangular bounding region to be eliminated from the printed document comprises the step of sending a blank bitmap graphic to the output buffer to overwrite the regions of the previously sent text elements within the third rectangular bounding region.
 7. The method of claim 6, wherein the step of sending a blank bitmap graphic comprises the step of sending a white rectangle to the output buffer having a fourth rectangular bounding region identical to a rectangular bounding region of the previously sent text elements.
 8. The method of claim 1, wherein the step of sending the text elements to an output buffer for transmission to the raster printer comprises the steps of: determining if the text element is supported by a raster printer resident device font; translating the text element into a device font character code when the text element is supported by a raster resident device font; and sending the device font character code to the output buffer.
 9. The method of claim 8, wherein the step of sending the text elements to an output buffer for transmission to the raster printer further comprises the step of drawing the text element as a bitmap text image on the bitmap buffer when the text element is not supported by a raster printer resident device font.
 10. The method of claim 9, wherein the step of sending the text elements to an output buffer for transmission to the raster printer comprises the steps of: determining if the text element is supportable by a raster printer downloadable device font; downloading a device font to the raster printer for storage therein, the device font utilizing character codes to select individual glyphs for printing; translating the text element into a device font character code; and sending the device font character code to the output buffer.
 11. A printer driver for controlling the printing by a printer of text and graphics data provided by an application program, the printer containing at least one device font stored therein having glyphs identified by a first character code, comprising: receiving the text and graphics data to be printed; identifying a location for the text and graphics data to be printed; sending the first character codes to the printer for text data whose location is non-overlapping with the location of any graphics data; sending a bitmap image to the printer of the graphics data whose location is non-overlapping with the location of any text data; and sending a bitmap image to the printer of the text and graphics data whose locations are overlapping. 